#coding=utf-8

def insertion_sort(data):
    for i in range(len(data)):
        cur_index = i
        while data[cur_index-1] >data[cur_index] and cur_index-1>=0:
            data[cur_index],data[cur_index-1] = data[cur_index-1],data[cur_index]
            cur_index -= 1
    return data

if __name__ == '__main__':
    data = [30,2,45,243,45,7,1,46,89]
    insertion_sort(data)
    print("排序后的数组：")
    for i in range(len(data)):
        print("%d"%data[i])